/*
 * @Descripttion: 
 * @Author: wind-lc
 * @version: 1.0
 * @Date: 2021-06-10 11:17:44
 * @LastEditTime: 2022-06-08 14:44:41
 * @FilePath: \cscec-pms-admin\src\components\StatusDisplay\index.js
 */
import { STATUS_MAP_Number, STATUS_MAP_STRING } from '@/config/businessConfig'
export default {
  props: {
    statusCode: {
      type: [String, Number, Boolean],
      default: ''
    },
    statusMap: {
      type: Object,
      default: null
    },
    isApproval: {
      type: Boolean,
      default: () => false
    },
  },
  data() {
    return {
      defaultOptions: STATUS_MAP_Number
    }
  },
  render(h) {
    const map = this.isApproval ? this.defaultOptions : this.statusMap || STATUS_MAP_STRING
    const status = this.statusCode
    return (
      <div style="display:flex; align-items: center;">
        <span
          style={{
            width: '5px',
            height: '5px',
            borderRadius: '50%',
            marginRight: '10px',
            flexShrink: 0,
            backgroundColor: map[status] && map[status].color
          }}
        ></span>
        <span>{map[status] && map[status].label}</span>
      </div>
    )
  }
}
